﻿using System;
using Soveryn.Commerce.BaseClasses;
using Soveryn.Commerce.Shared;

namespace Soveryn.Commerce.Doodads
{

    public partial class CartSearch : DoodadBaseClass
    {

        new protected void Page_Load(object sender, EventArgs e)
        {

            base.Page_Load(sender, e);

            if (IsPostBack)
                return;

            CartImage.ImageUrl = "/Files/Themes/" + ParentPage.Website.DesignFolder + "/cart.png";
            HTMLLiteral.Text = Properties.DoodadInstanceHTML.Replace("[count]", DataUtils.GetCookie(Request, "CustomerCartLineCount", "0"));

            if (ParentPage.EditMode && ParentPage.EmployeeLoggedIn)
            {
                HTMLPanel.CssClass = "editable";
                HTMLPanel.Attributes.Add("data-id", Properties.ElementID);
            }

            SearchLinkButton.Text = GetPropertyValue("SearchButtonText");

        }

        protected void SearchLinkButton_Click(object sender, EventArgs e)
        {

            Response.Redirect("/Page.aspx?PageID=" + ParentPage.Website.SearchPageID + "&Search=" + SearchTextBox.Text, true);

        }

    }
}
